#!/bin/sh
# Source validation pre-commit hook
#
# This script collects all modified files and runs it through our source code
# validation script. The validation script returns 0 on success and 1 on any
# failure.
#
# To enable, symlink this file to '.git/hooks/pre-commit' like so:
#   ln -s ../../script/git-hooks/pre-commit .git/hooks/pre-commit

files=$(git diff --name-only HEAD --diff-filter=d | grep '\.\(cpp\|h\)$')
python script/validators/source_validator.py --files $files
exit $?
